from flask import Flask, request,render_template
from config import DevConfig
import json

#################
# 功能接口START #
#################
from Weather import Core as WeatherC
from Talk import Core as TalkC

###############
# 功能接口END #
###############

app = Flask(__name__)
app.config.from_object(DevConfig)

@app.route("/",methods=["GET"])
def Index():
    return app.send_static_file("html/index.html")

@app.route("/weather1d",methods=["GET"])
def GetWeather1D():
    province = request.args.get("province")
    city = request.args.get("city")
    country = request.args.get("country")
    data = WeatherC.GetWeather1D(province, city, country)
    return data


@app.route("/talk",methods=["GET"])
def Talk():
    msg = request.args.get("msg")
    data = TalkC.Talk(msg)
    return data


if __name__ == '__main__':
    app.run("0.0.0.",port=1024)
